/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.fsiebert.polytech.db.mediatheque.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Florent
 */
@Entity
@Table(name = "Suggestion")
@NamedQueries({
    @NamedQuery(name = "Suggestion.findAll", query = "SELECT s FROM Suggestion s"),
    @NamedQuery(name = "Suggestion.findBySuggestion", query = "SELECT s FROM Suggestion s WHERE s.suggestion = :suggestion"),
    @NamedQuery(name = "Suggestion.findByType", query = "SELECT s FROM Suggestion s WHERE s.type = :type"),
    @NamedQuery(name = "Suggestion.findByInformations", query = "SELECT s FROM Suggestion s WHERE s.informations = :informations")})
public class Suggestion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "Suggestion", nullable = false)
    private Integer suggestion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "Type", nullable = false, length = 10)
    private String type;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "Informations", nullable = false, length = 10)
    private String informations;
    @JoinColumn(name = "NoCarte", referencedColumnName = "NoCarte", nullable = false)
    @ManyToOne(optional = false)
    private Adherent noCarte;

    public Suggestion() {
    }

    public Suggestion(Integer suggestion) {
        this.suggestion = suggestion;
    }

    public Suggestion(Integer suggestion, String type, String informations) {
        this.suggestion = suggestion;
        this.type = type;
        this.informations = informations;
    }

    public Integer getSuggestion() {
        return suggestion;
    }

    public void setSuggestion(Integer suggestion) {
        this.suggestion = suggestion;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getInformations() {
        return informations;
    }

    public void setInformations(String informations) {
        this.informations = informations;
    }

    public Adherent getNoCarte() {
        return noCarte;
    }

    public void setNoCarte(Adherent noCarte) {
        this.noCarte = noCarte;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (suggestion != null ? suggestion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Suggestion)) {
            return false;
        }
        Suggestion other = (Suggestion) object;
        if ((this.suggestion == null && other.suggestion != null) || (this.suggestion != null && !this.suggestion.equals(other.suggestion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "eu.fsiebert.polytech.db.mediatheque.entity.Suggestion[ suggestion=" + suggestion + " ]";
    }
    
}
